package com.ks.service;


import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ks.entity.Book;
import com.ks.mapper.BookMapper;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;

import java.util.List;

/**
 * @program: scrapy
 * @description:
 * @author: Liu Weidong
 * @create: 2023-01-01 20:03
 **/
@Service
public class BookService extends ServiceImpl<BookMapper, Book> {

    public void saveBatchBook(List<Book> bookList) {
        saveBatch(bookList);
    }

    public Book findOne() {
        return baseMapper.selectById(100);
    }


    public Page<Book> findByPage(int pageNo, int pageSize){
        Page<Book> page = Page.of(pageNo, pageSize);
        LambdaQueryWrapper<Book> bookLambdaQueryWrapper = new LambdaQueryWrapper<>();
      //   bookLambdaQueryWrapper.eq(StringUtils.isEmpty("d"),Book::getBo,"dd");
        return baseMapper.selectPage(page, new QueryWrapper<Book>());
    }
}
